<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2018/6/11
  Time: 8:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登陆的测试</title>
    <%//第二次登录    读取cookie
        String name="";
        String pwd="";
        if (request.getCookies()!=null){
            Cookie[] cookies= request.getCookies();
            for (Cookie c:cookies){
              // System.out.println(c.getName()+"--------"+c.getValue());}
               if (c.getName().equals("username")){
                    name=c.getValue();
                }
                if (c.getName().equals("password")){
                    pwd=c.getValue();
                }
            }
        }
   %>
</head>
<body>
<form action="CookieTestServlet" method="get">
    <table align="center">
        <tr>
            <td>用户名</td>
            <td><input type="text" id="name" name="name" value="<%=name%>"></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input type="password" id="pwd" name="pwd" value="<%=pwd%>"></td>
        </tr>
        <tr>
            <td colspan="2"><input type="submit" value="登陆"></td>

        </tr>
    </table>
</form>
</body>
</html>
